﻿@model Model.tb_document
@{
    ViewBag.Title = "doDocInfo";
}
<!DOCTYPE html>

<head>
    <meta name="viewport" content="width=device-width" />
    <title></title>
</head>
<body>
    @using (Ajax.BeginForm("NewDoc", "DocManagerWithDir", new AjaxOptions { HttpMethod = "Post", OnSuccess = "handle", OnFailure = "failed" }, new { @id = "uploadfrm" }))
    {
        @Html.HiddenFor(m => m.id)
        @Html.HiddenFor(m => m.doc_CreateDate, new { @id = "createDateE" })
        @Html.HiddenFor(m => m.doc_CreateUser, new { @id = "createUserE" })
        @Html.HiddenFor(m => m.doc_UpdateDate, new { @id = "updateDateE" })
        @Html.HiddenFor(m => m.doc_UpdateUser, new { @id = "updateUserE" })
        @Html.HiddenFor(m => m.isDelete)
        @Html.HiddenFor(m => m.direct_Id, new { @id = "hiddenDirId" })
        @Html.HiddenFor(m => m.doc_URL, new { @id = "hiddenUrl" })
        <table align="center" height="99%" width="99%" style="font-family: '宋体'; font-size: 12px;" class="DialogTable">
            <tr>
                <td align="right">文档编码：</td>
                <td align="left">@Html.TextBoxFor(m => m.doc_Code,new { @style = "width:80%"  })</td>
                <td align="right">文件名称：</td>
                <td align="left">
                    <table align="left" width="99%">
                        <tr>
                            <td>@Html.TextBoxFor(m => m.doc_Name, new { @id = "txtName",@style = "width:80%"  })</td>
                            <td>
                                <input type="text" id="uploadify" /></td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td align="right" valign="middle">状态：</td>
                <td align="left">
                    @Html.DropDownListFor(m => m.doc_Status, ViewData["cbo_zhuangtai"] as SelectList,new { @style = "width:80%" })                    </td>
                <td align="right">大小：</td>
                <td align="left">@Html.TextBoxFor(m => m.doc_Size, new { @id = "txtSize",@style = "width:80%"  }) KB</td>
            </tr>
            <tr>
                <td align="right">实施日期：</td>
                <td align="left">
                    @Html.TextBoxFor(m => m.doc_CreateDate,new { @style = "width:80%" })                    </td>
                <td align="right">关键字：</td>
                <td align="left">
                    @Html.TextBoxFor(m => m.doc_KeyWord,new { @style = "width:90%" })                    </td>
            </tr>
            <tr>
                <td align="right">文件目录：</td>
                <td align="left">
                    <input type="text" name="txtdirValueN" id="txtdirValueN" value='@ViewBag.ptext' />
                </td>
                <td align="right"></td>
                <td align="left"></td>
            </tr>
            <tr>
                <td height="100" align="right" valign="top">备注：</td>
                <td height="100" colspan="3" align="left" valign="top">
                    @Html.TextAreaFor(m => m.remark, new { @style = "height:100px;width:99%" })                    </td>
            </tr>
            <tr>
                <td colspan="4" align="center">
                    <a href="javascript:void(0)" onclick="$('#uploadfrm').submit()">
                        <img src="~/Content/Images/baocun.png" /></a>
                    <a href="javascript:void(0)" onclick="Close_dlg()">
                        <img src="~/Content/Images/quxiao.png" />
                    </a></td>
            </tr>
        </table>
    }
    <script type="text/javascript">
        $('#doc_CreateDate').click(function () { WdatePicker() });
        $("#uploadify").uploadify({
            'uploader': '@Url.Content("~/Scripts/uploader/uploadify.swf")',
            'script': '@Url.Action("Import", "DocManagerWithDir")',
            'cancelImg': '@Url.Content("~/Scripts/uploader/cancel.png")',
            'folder': 'UpFile',
            'queueID': 'fileQueue',
            'auto': false,
            'multi': false,
            'height': 20,
            'width': 75,
            'fileSizeLimit': '10240KB',
            'fileTypeDesc': '文档类型',
            'fileTypeExts': '*.doc;*.pdf;',
            'buttonImg': '@Url.Content("~/Content/Images/daochuwenjian.png")',
            'onComplete': fun,
            'onSelect': function (e, queueId, fileObj) {
                $('#uploadify').uploadifyUpload();
            },
            'onCancel': function (file) {

            }
        });

        function fun(event, queueID, fileObj, response, data) {
            if (response == "false") {
                alert("文件上传出错！");
            }
            else {
                if (/\.(pdf)$/.test(response)) {
                    response = response.substring(0, response.length - 4) + ".swf";
                }
                $('#hiddenUrl').val(response);
                $('#txtName').val(fileObj.name);
                $('#txtSize').val(parseInt(fileObj.size / 1000));
                alert("成功上传！");
            }
        }

        /*页面控件验证*/
        $("#txtName").attr("datatype", "s1-50");
        $("#doc_Code").attr("datatype", "*");
        $("#cbo_zhuangtai").attr("datatype", "d");
        $("#txtSize").attr("datatype", "*");
        $("#doc_CreateDate").attr("datatype", "*");
        $("#doc_KeyWord").attr("datatype", "*");
        $("#uploadfrm").Validform({
            tiptype: 3
        });
        /*结束 页面控件验证*/
        $("#doc_Code").val('@ViewBag._code');    
        
        
    </script>
</body>
